using dnAnalytics.Math;
using NUnit.Framework;

namespace dnAnalytics.Tests.Math
{
    [TestFixture]
    public class ComplexMath_AsinTest
    {
        [Test]
        public void Asin()
        {
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, 1.19209289550780998537e-7)), new Complex(0.0, 1.19209289550780716193e-7), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, -1.19209289550780998537e-7)), new Complex(0.0, -1.19209289550780716193e-7), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, 5.0e-1)), new Complex(0.0, 4.81211825059603447498e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, -5.0e-1)), new Complex(0.0, -4.81211825059603447498e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, 1.0)), new Complex(0.0, 8.81373587019543025233e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, -1.0)), new Complex(0.0, -8.81373587019543025233e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, 2.0)), new Complex(0.0, 1.44363547517881034249), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, -2.0)), new Complex(0.0, -1.44363547517881034249), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, 8.388608e6)), new Complex(0.0, 1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(0.0, -8.388608e6)), new Complex(0.0, -1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, 0.0)), new Complex(1.19209289550781280881e-7, 0.0), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, 0.0)), new Complex(-1.19209289550781280881e-7, 0.0), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, 1.19209289550780998537e-7)), new Complex(1.19209289550780433848e-7, 1.19209289550781563226e-7), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, -1.19209289550780998537e-7)), new Complex(1.19209289550780433848e-7, -1.19209289550781563226e-7), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, 1.19209289550780998537e-7)), new Complex(-1.19209289550780433848e-7, 1.19209289550781563226e-7), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, -1.19209289550780998537e-7)), new Complex(-1.19209289550780433848e-7, -1.19209289550781563226e-7), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, 5.0e-1)), new Complex(1.06624029994000753133e-7, 4.81211825059605989613e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, -5.0e-1)), new Complex(1.06624029994000753133e-7, -4.81211825059605989613e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, 5.0e-1)), new Complex(-1.06624029994000753133e-7, 4.81211825059605989613e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, -5.0e-1)), new Complex(-1.06624029994000753133e-7, -4.81211825059605989613e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, 1.0)), new Complex(8.42936970217878358509e-8, 8.81373587019545537381e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, -1.0)), new Complex(8.42936970217878358509e-8, -8.81373587019545537381e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, 1.0)), new Complex(-8.42936970217878358509e-8, 8.81373587019545537381e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, -1.0)), new Complex(-8.42936970217878358509e-8, -8.81373587019545537381e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, 2.0)), new Complex(5.33120149970003008054e-8, 1.44363547517881161355), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, -2.0)), new Complex(5.33120149970003008054e-8, -1.44363547517881161355), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, 2.0)), new Complex(-5.33120149970003008054e-8, 1.44363547517881161355), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, -2.0)), new Complex(-5.33120149970003008054e-8, -1.44363547517881161355), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, 8.388608e6)), new Complex(1.42108547152018727665e-14, 1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.19209289550780998537e-7, -8.388608e6)), new Complex(1.42108547152018727665e-14, -1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, 8.388608e6)), new Complex(-1.42108547152018727665e-14, 1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.19209289550780998537e-7, -8.388608e6)), new Complex(-1.42108547152018727665e-14, -1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, 0.0)), new Complex(5.23598775598298873077e-1, 0.0), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, 0.0)), new Complex(-5.23598775598298873077e-1, 0.0), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, 1.19209289550780998537e-7)), new Complex(5.23598775598293403317e-1, 1.37651030824094033271e-7), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, -1.19209289550780998537e-7)), new Complex(5.23598775598293403317e-1, -1.37651030824094033271e-7), 8);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, 1.19209289550780998537e-7)), new Complex(-5.23598775598293403317e-1, 1.37651030824094033271e-7), 8);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, -1.19209289550780998537e-7)), new Complex(-5.23598775598293403317e-1, -1.37651030824094033271e-7), 8);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, 5.0e-1)), new Complex(4.52278447151190682064e-1, 5.30637530952517826017e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, -5.0e-1)), new Complex(4.52278447151190682064e-1, -5.30637530952517826017e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, 5.0e-1)), new Complex(-4.52278447151190682064e-1, 5.30637530952517826017e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, -5.0e-1)), new Complex(-4.52278447151190682064e-1, -5.30637530952517826017e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, 1.0)), new Complex(3.49439062857213293627e-1, 9.2613303135018242455e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, -1.0)), new Complex(3.49439062857213293627e-1, -9.2613303135018242455e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, 1.0)), new Complex(-3.49439062857213293627e-1, 9.2613303135018242455e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, -1.0)), new Complex(-3.49439062857213293627e-1, -9.2613303135018242455e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, 2.0)), new Complex(2.21018635622883858902e-1, 1.46571535194729052178), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, -2.0)), new Complex(2.21018635622883858902e-1, -1.46571535194729052178), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, 2.0)), new Complex(-2.21018635622883858902e-1, 1.46571535194729052178), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, -2.0)), new Complex(-2.21018635622883858902e-1, -1.46571535194729052178), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, 8.388608e6)), new Complex(5.96046447753901308974e-8, 1.66355323334386927551e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(5.0e-1, -8.388608e6)), new Complex(5.96046447753901308974e-8, -1.66355323334386927551e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, 8.388608e6)), new Complex(-5.96046447753901308974e-8, 1.66355323334386927551e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-5.0e-1, -8.388608e6)), new Complex(-5.96046447753901308974e-8, -1.66355323334386927551e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, 0.0)), new Complex(1.57079632679489661923, 0.0), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, 0.0)), new Complex(-1.57079632679489661923, 0.0), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, 1.19209289550780998537e-7)), new Complex(1.57045105981532529509, 3.45266986431162764654e-4), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, -1.19209289550780998537e-7)), new Complex(1.57045105981532529509, -3.45266986431162764654e-4), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, 1.19209289550780998537e-7)), new Complex(-1.57045105981532529509, 3.45266986431162764654e-4), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, -1.19209289550780998537e-7)), new Complex(-1.57045105981532529509, -3.45266986431162764654e-4), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, 5.0e-1)), new Complex(8.95907481208890239067e-1, 7.32857675973645260889e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, -5.0e-1)), new Complex(8.95907481208890239067e-1, -7.32857675973645260889e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, 5.0e-1)), new Complex(-8.95907481208890239067e-1, 7.32857675973645260889e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, -5.0e-1)), new Complex(-8.95907481208890239067e-1, -7.32857675973645260889e-1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, 1.0)), new Complex(6.66239432492515255104e-1, 1.06127506190503565203), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, -1.0)), new Complex(6.66239432492515255104e-1, -1.06127506190503565203), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, 1.0)), new Complex(-6.66239432492515255104e-1, 1.06127506190503565203), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, -1.0)), new Complex(-6.66239432492515255104e-1, -1.06127506190503565203), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, 2.0)), new Complex(4.27078586392476125481e-1, 1.52857091948099816127), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, -2.0)), new Complex(4.27078586392476125481e-1, -1.52857091948099816127), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, 2.0)), new Complex(-4.27078586392476125481e-1, 1.52857091948099816127), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, -2.0)), new Complex(-4.27078586392476125481e-1, -1.52857091948099816127), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, 8.388608e6)), new Complex(1.19209289550779838278e-7, 1.66355323334386980842e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(1.0, -8.388608e6)), new Complex(1.19209289550779838278e-7, -1.66355323334386980842e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, 8.388608e6)), new Complex(-1.19209289550779838278e-7, 1.66355323334386980842e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-1.0, -8.388608e6)), new Complex(-1.19209289550779838278e-7, -1.66355323334386980842e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, 0.0)), new Complex(-1.57079632679489661923, 1.31695789692481670863), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, 1.19209289550780998537e-7)), new Complex(1.57079625796938120718, 1.31695789692481944351), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, -1.19209289550780998537e-7)), new Complex(1.57079625796938120718, -1.31695789692481944351), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, 1.19209289550780998537e-7)), new Complex(-1.57079625796938120718, 1.31695789692481944351), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, -1.19209289550780998537e-7)), new Complex(-1.57079625796938120718, -1.31695789692481944351), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, 5.0e-1)), new Complex(1.29304207023718265905, 1.36180090085784578821), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, -5.0e-1)), new Complex(1.29304207023718265905, -1.36180090085784578821), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, 5.0e-1)), new Complex(-1.29304207023718265905, 1.36180090085784578821), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, -5.0e-1)), new Complex(-1.29304207023718265905, -1.36180090085784578821), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, 1.0)), new Complex(1.06344002357775205619, 1.46935174436818527326), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, -1.0)), new Complex(1.06344002357775205619, -1.46935174436818527326), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, 1.0)), new Complex(-1.06344002357775205619, 1.46935174436818527326), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, -1.0)), new Complex(-1.06344002357775205619, -1.46935174436818527326), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, 2.0)), new Complex(7.54249144698046040708e-1, 1.73432452148796644796), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, -2.0)), new Complex(7.54249144698046040708e-1, -1.73432452148796644796), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, 2.0)), new Complex(-7.54249144698046040708e-1, 1.73432452148796644796), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, -2.0)), new Complex(-7.54249144698046040708e-1, -1.73432452148796644796), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, 8.388608e6)), new Complex(2.38418579101556288425e-7, 1.66355323334387194004e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(2.0, -8.388608e6)), new Complex(2.38418579101556288425e-7, -1.66355323334387194004e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, 8.388608e6)), new Complex(-2.38418579101556288425e-7, 1.66355323334387194004e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-2.0, -8.388608e6)), new Complex(-2.38418579101556288425e-7, -1.66355323334387194004e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, 0.0)), new Complex(-1.57079632679489661923, 1.66355323334386838733e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, 1.19209289550780998537e-7)), new Complex(1.57079632679488240838, 1.66355323334386838733e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, -1.19209289550780998537e-7)), new Complex(1.57079632679488240838, -1.66355323334386838733e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, 1.19209289550780998537e-7)), new Complex(-1.57079632679488240838, 1.66355323334386838733e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, -1.19209289550780998537e-7)), new Complex(-1.57079632679488240838, -1.66355323334386838733e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, 5.0e-1)), new Complex(1.57079626719025184384, 1.66355323334386856497e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, -5.0e-1)), new Complex(1.57079626719025184384, -1.66355323334386856497e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, 5.0e-1)), new Complex(-1.57079626719025184384, 1.66355323334386856497e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, -5.0e-1)), new Complex(-1.57079626719025184384, -1.66355323334386856497e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, 1.0)), new Complex(1.57079620758560706845, 1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, -1.0)), new Complex(1.57079620758560706845, -1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, 1.0)), new Complex(-1.57079620758560706845, 1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, -1.0)), new Complex(-1.57079620758560706845, -1.66355323334386909787e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, 2.0)), new Complex(1.57079608837631751767, 1.6635532333438712295e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, -2.0)), new Complex(1.57079608837631751767, -1.6635532333438712295e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, 2.0)), new Complex(-1.57079608837631751767, 1.6635532333438712295e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, -2.0)), new Complex(-1.57079608837631751767, -1.6635532333438712295e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, 8.388608e6)), new Complex(7.85398163397446533259e-1, 1.69821059237186600807e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(8.388608e6, -8.388608e6)), new Complex(7.85398163397446533259e-1, -1.69821059237186600807e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, 8.388608e6)), new Complex(-7.85398163397446533259e-1, 1.69821059237186600807e1), 9);
            TestHelper.TestSignificantDigits(ComplexMath.Asin(new Complex(-8.388608e6, -8.388608e6)), new Complex(-7.85398163397446533259e-1, -1.69821059237186600807e1), 9);
        }
    }
}